import { defineStore } from "pinia";
import {getGoodsApi} from '@/server'

const goodsStore=defineStore('good',{
  state:()=>({
    goodList:JSON.parse(localStorage.getItem('goodList'))
  }),
  actions:{
    // 获取所有商品分类
    async getGoods(params){
      let res=await getGoodsApi(params)
      // console.log(res.data.result);
      this.goodList=res.data.result
      localStorage.setItem('goodList',JSON.stringify(res.data.result))
    },
  },
})
export default goodsStore